package com.hnl.test;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.hnl.dao.ActivityDAO;
import com.hnl.dao.DAOException;
import com.hnl.dao.HNLDAOFactory;
import com.hnl.dao.MiscDAO;
import com.hnl.dao.MiscTypeDAO;
import com.hnl.to.Activity;
import com.hnl.to.Misc;
import com.hnl.to.MiscType;

@Deprecated
public class GenTestDataYSL {
	public static final Logger LOG = LoggerFactory
			.getLogger(GenerateTestData.class);

	public static void genMiscData() {
		try {
			MiscTypeDAO misctypeDAO = HNLDAOFactory.getDAOFactory(
					HNLDAOFactory.HNLDAOFACTORY).getMiscTypeDAO();
			MiscDAO miscDAO = HNLDAOFactory.getDAOFactory(
					HNLDAOFactory.HNLDAOFACTORY).getMiscDAO();

			Date now = new Date();

			MiscType newMisctype = new MiscType();
			newMisctype.setTypeName("Activity");
			newMisctype.setTypeDesc("Activity type");
			newMisctype.setCreateUser(1);
			newMisctype.setCreateDate(now);
			newMisctype.setModifyUser(1);
			newMisctype.setModifyDate(now);

			Misc newMisc = new Misc();
			newMisc.setMiscName("TEL");
			newMisc.setMiscDesc("Activity TEL");
			newMisc.setMiscTypeID(newMisctype.getMiscTypeID());
			newMisc.setCreateUser(1);
			newMisc.setCreateDate(now);
			newMisc.setModifyUser(1);
			newMisc.setModifyDate(now);

			newMisc = new Misc();
			newMisc.setMiscName("Face to face");
			newMisc.setMiscDesc("Activity Face to face");
			newMisc.setMiscTypeID(newMisctype.getMiscTypeID());
			newMisc.setCreateUser(1);
			newMisc.setCreateDate(now);
			newMisc.setModifyUser(1);
			newMisc.setModifyDate(now);

			// test add misctype and misc
		} catch (DAOException e) {
			LOG.error("Error in Getting DAO. ", e);
		}

	}

	public static void genActivityData() {
		try {
			ActivityDAO activityDAO = HNLDAOFactory.getDAOFactory(
					HNLDAOFactory.HNLDAOFACTORY).getActivityDAO();

			Date now = new Date();
			Activity newact = new Activity();

			newact.setTalentID(1);
			newact.setActivityType(1);
			newact.setCreateDate(now);
			newact.setCreateUser(1);
			newact.setIsdelete(false);
			newact.setModifyDate(now);
			newact.setModifyUser(1);
			activityDAO.saveActivity(newact);
		} catch (DAOException e) {
			LOG.error("Error in generate Activity Data!!");
		}

	}
}
